package model

import (
	"fmt"
	"time"
)

type LocalDate time.Time

func (l LocalDate) MarshalJSON() ([]byte, error) {
	stamp := fmt.Sprintf("\"%s\"", time.Time(l).Format("2006-01-02"))
	return []byte(stamp), nil
}

func (l LocalDate) Format() string {
	return time.Time(l).Format("2006-01-02")
}

type Count struct {
	Type       string `json:"type"`
	Total      int64  `json:"total"`
	Constitute struct {
		Max     int64  `json:"max"`
		MaxName string `json:"max_name"`
		Min     int64  `json:"min"`
		MinName string `json:"min_name"`
	} `json:"constitute"`
	Career struct {
		Max     int64  `json:"max"`
		MaxName string `json:"max_name"`
		Min     int64  `json:"min"`
		MinName string `json:"min_name"`
	} `json:"career"`
}

type Total struct {
	Name     string  `json:"name"`
	Count    int64   `json:"count"`
	AvgScore float64 `json:"avg_score"`
}

type RespTotal struct {
	Type  string  `json:"type"`
	Point []Total `json:"point"`
}

type CountInfo struct {
	Name     string  `json:"name"`
	Count    int64   `json:"count"`
	AvgScore float64 `json:"avg_score"`
}
